package com.cloud.quickcore.admin.enums;

import com.alibaba.fastjson.annotation.JSONType;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;

import java.util.Objects;

/**
 * 激活标志 --枚举类
 * @author NiJo_H
 * @version 1.0
 * @date 2019/7/28 0:16
 */
@Getter
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
@JSONType(serializeEnumAsJavaBean = true)
public enum ActiveTypeEnum {
    NOT_ACTIVE(0,"未激活"),
    SUCCEED_ACTIVE(1,"成功激活");

    private Integer code;

    private String value;

    ActiveTypeEnum(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public Integer getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    //获取枚举实例
    public static ActiveTypeEnum fromValue(Integer value) {
        for (ActiveTypeEnum activeTypeEnum : ActiveTypeEnum.values()) {
            if (Objects.equals(value, activeTypeEnum.getCode())) {
                return activeTypeEnum;
            }
        }
        throw new IllegalArgumentException();
    }

}
